package com.q.course.dao.user;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.q.course.entity.user.User;

public interface UserDao extends PagingAndSortingRepository<User, Long> {

	@Query("select u.id, u.name, (select count(a.id) from Arrange a where a.existState=true and a.teacherId=u.id and a.startTime between ?1 and ?2) from User u where u.existState=true")
	List<Object[]> findByExistState( Date st, Date et );
	List<User> findByExistState( Boolean b );
	User findByExistStateAndLoginName(boolean b, String loginName);
	User findByExistStateAndId(boolean b, Long id);
}
